﻿var clock_dateArea;		//显示日期的区域(span)
var clock_clockArea;	//显示时间的区域(span)
var clock_dateTimeid;	
var clock_clockTimeid;

function showDate()
{
	if (!document.layers&&!document.all)
	   return
	var Digital=new Date()
	var year=Digital.getYear()
	var month=Digital.getMonth()
	var day=Digital.getDate()
	var weekday=Digital.getDay()
	if (year < 1000)
	  year += 1900
	month=month+1
	if (1==weekday)
	  weekday="一"
	else if (2==weekday)
	  weekday="二"
	else if (3==weekday)
	  weekday="三"
	else if (4==weekday)
	  weekday="四"
	else if (5==weekday)
	  weekday="五 "
	else if (6==weekday)
	  weekday="六"
	else
	 weekday="日"
	var myclock=year+"年"+month+"月"+day+"日&nbsp"+"星期"+weekday
	if (document.layers)
	{
	  document.layers.liveclockNC.document.write(myclock)
	  document.layers.liveclockNC.document.close()
	}
	else if (document.all)
	  clock_dateArea.innerHTML=myclock
	clock_dateTimeid=setTimeout("showDate()",1000)

	return
}

function showClock()
{
	if (!document.layers&&!document.all)
	   return
	var Digital=new Date()
	var hour=Digital.getHours()
	var minute=Digital.getMinutes()
	var second=Digital.getSeconds()

	var myclock=fixString(hour)+"："+fixString(minute)+"："+fixString(second)
	if (document.layers)
	{
	  document.layers.liveclockNC.document.write(myclock)
	  document.layers.liveclockNC.document.close()
	}
	else if (document.all)
	  clock_clockArea.innerHTML=myclock
	clock_clockTimeid=setTimeout("showClock()",1000)

	return
}

var clock_StreamArea;		//显示时间流的区域(span)
var clock_StreamTimeid;
var clock_Digital=new Date(0,0,0,0,0,0,0);

function TimeStream(){
	if (!document.layers&&!document.all)
	   return
	var Digital=clock_Digital;
	var hour=Digital.getHours();
	var minute=Digital.getMinutes();
	var second=Digital.getSeconds();
	var ms=Digital.getMilliseconds()+100;
	
	clock_Digital=new Date(0,0,0,hour,minute,second,ms);

	ms=(ms-100)/100
	var myclock=fixString(hour)+"："+fixString(minute)+"："+fixString(second)+" "+ms;
	if (document.layers)
	{
	  document.layers.liveclockNC.document.write(myclock)
	  document.layers.liveclockNC.document.close()
	}
	else if (document.all)
	  clock_StreamArea.innerHTML=myclock
	  
	clock_StreamTimeid=setTimeout("TimeStream()",100)

	return
}

function StopClock(iTimeID){
	window.self.clearTimeout(iTimeID);
}

function fixString(strVal){
	var sVal = strVal.toString(10);
	if (sVal.length<2)
		sVal = "0" + sVal;
	return sVal
}